﻿using Nop.Core.Domain.Common;
using Nop.Core.Domain.Logistics;
using System.Collections.Generic;

namespace Logistics.Services
{
    public class PlanType
    {
        public Address WareHouse { get; set; }
        public LogisticsLocation[] UnresolvedWaypoints { get; set; }
        public DriverAssignment[] DriverAssignments { get; set; }
        public CaculateMethod Method { get; set; }
    }

    public class DriverAssignment
    {
        public LogisticsCourier Driver { get; set; }
        public LogisticsLocation[] GoWaypoints { get; set; }
        public LogisticsLocation[] ReturningWaypoints { get; set; }
        public LogisticsLocation[] UnresolvedWaypoints { get; set; }

        public override bool Equals(object obj)
        {
            if (obj is DriverAssignment)
            {
                return ((DriverAssignment)obj).Driver == this.Driver;
            }
            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }

    public class TravelInformation
    {
        public Dictionary<Address, double> Durations { get; set; }
        public Dictionary<Address, double> Distances { get; set; }
    }

    public enum CaculateMethod
    {
        ByDistance,
        ByDuration
    }
}
